package br.com.financas.util;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JPAUtil {
	private static EntityManagerFactory emf;
	private static EntityManager em;

	public static final EntityManager getEntityManager() {
		if (em == null) {
			if (emf == null) {
				emf = Persistence
						.createEntityManagerFactory("MinhasFinancas");
			}

			em = emf.createEntityManager();
		}
		return em;
	}
}
